<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
</head>
<body>
<script>
  // 当注册多个请求拦截器的时候, 后注册的先执行
  axios.interceptors.request.use((config) => {
    console.log('first')
    return config
  }, (reason) => {
    console.log(reason)
    return Promise.reject(reason)
  })
  axios.interceptors.request.use((config) => {
    throw new Error('second error')
  })
  axios.get('http://localhost:3000/todos').then ((response) => {
    console.log(response.data)
  }, (reason) => {
    console.log(reason)
  })
</script>
</body>
</html>